<template>
  <div>
    <h4>HelloB</h4>
    <p>a: {{ a }}</p>
    <button @click="changeA('245')">点我，修改 state a</button>

    <button @click="abc('456')">点我，修改 state a</button>
  </div>
</template>

<script>
import { mapState, mapMutations } from "vuex";

export default {
  data() {
    return {
      count: 100,
    };
  },

  computed: {
    ...mapState(["a"]),
  },

  // methods: {
  //   changeA(a) {
  //     this.$store.commit("changeA", a);
  //   },
  //   abc(aaa) {
  //     this.$store.commit('changeA', aaa)
  //   }
  // },

  methods: {
    ...mapMutations(["changeA"]),
    ...mapMutations({
      abc: "changeA",
    }),
  },
};
</script>
